#!/bin/bash

svrmgrl << EOF
connect internal
startup nomount pfile = ${ORACLE_BASE}/admin/${ORACLE_SID}/pfile/init${ORACLE_SID}.ora
create database ${ORACLE_SID} maxdatafiles 254 maxinstances 8 maxlogfiles 32    character set ZHS16GBK national character set ZHS16GBK datafile '${ORACLE_BASE}/oradata/${ORACLE_SID}/system01.dbf' SIZE 150M logfile group 1 ('${ORACLE_BASE}/oradata/${ORACLE_SID}/redo01.log') size 10M,group 2 ('${ORACLE_BASE}/oradata/${ORACLE_SID}/redo02.log') size 10M;

create tablespace rbs datafile '${ORACLE_BASE}/oradata/${ORACLE_SID}/rbs01.dbf' size 200M default storage (initial 128k next 128k pctincrease 0 minextents 2 maxextents unlimited);
 
create public rollback segment r01 tablespace rbs storage( initial 128K next 128K maxextents unlimited optimal 10M);
create public rollback segment r02 tablespace rbs storage( initial 128K next 128K maxextents unlimited optimal 10M);
create public rollback segment r03 tablespace rbs storage( initial 128K next 128K maxextents unlimited optimal 10M);
create public rollback segment r04 tablespace rbs storage( initial 128K next 128K maxextents unlimited optimal 10M);
alter rollback segment r01 online;
alter rollback segment r02 online;
alter rollback segment r03 online;
alter rollback segment r04 online;

create tablespace temp datafile '${ORACLE_BASE}/oradata/${ORACLE_SID}/temp01.dbf' size 100M default storage (initial 128k next 128k pctincrease 0 maxextents unlimited) temporary;

@${ORACLE_HOME}/rdbms/admin/catalog.sql;
@${ORACLE_HOME}/rdbms/admin/catproc.sql;
@${ORACLE_HOME}/rdbms/admin/caths.sql;
@${ORACLE_HOME}/rdbms/admin/otrcsvr.sql;

connect system/manager
@${ORACLE_HOME}/sqlplus/admin/pupbld.sql

disconnect
exit
EOF
